<template>
  <div id="landdetails">  

    <el-form ref="form" :model="form" label-width="80px">  
     <el-row> 

        <el-col :span="20" style="display:flex;">
             <div style="height:38px;line-height:38px;"> 
                  <i class="el-icon-back" @click="goBack"></i> 
                  {{ $route.query.name }} 
                </div>
            <el-form-item label="" label-width="0px" style="margin-left:5px;">           
                      <el-date-picker  type="date"  placeholder="开始日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time1" style="width:150px;"></el-date-picker>             
            </el-form-item>
             <el-form-item label="" label-width="0px" style="margin-left:5px;">           
                      <el-date-picker  type="date"  placeholder="结束日期" format="yyyy-MM-dd" value-format="yyyy-MM-dd"  v-model="form.time2" style="width:150px;"></el-date-picker>             
            </el-form-item>
             <el-form-item label-width="0px" label="" style="margin-left:5px;">
                <el-input v-model="form.phone" placeholder="帐号" style="width:150px;"></el-input>
            </el-form-item>
           <div class="custom_button2"  style="margin-left:10px;" @click="search_but"></div>
        </el-col>

        <el-col :span="4" style="text-align: right;">  
            <el-button type="primary" class="custom_color_button" style="margin-bottom:10px;" @click="refresh_but()">刷新</el-button>            
          </el-col>
    
    </el-row> 
   
   </el-form>
   <!-- 渲染数据list -->
   <details-gashapon-list :datalist="datalist" @up_list_fun="list_fun"> </details-gashapon-list>

      
   <div style="margin-top:20px;text-align: center;">
      <el-pagination
        background
        @current-change="handleCurrentChange"
        :page-size="10"  
        layout="prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>
    
  </div>
</template>

<script>
import DetailsGashaponList from '@/view/Activity/DetailsGashaponList'
export default {
  name: 'landdetails',
  data () {
    return {
        datalist:[{"name":"1111"}],
        page:1,
        count:0,
        form:{
           time1:'',
           time2:'',
           phone:''
        },
    }
  },
 components:{
    DetailsGashaponList
  },
  created(){
     this.list_fun()
  },
  mounted (){
    
  },
  methods: {
      list_fun(){
          this.post("/lottery_shake/listOfWinPrize", {
              page:this.page,
              account:this.form.phone,
              startdate:this.form.time1,
              enddate:this.form.time2
	        }).then(res => {
            this.count = res.result.count
            this.datalist = res.result.list

            for(let item of this.datalist) {
               
               if(item.qr_code){
                   for(let a of item.qr_code) {
                   if(a.collection_type == 1){
                      item.srcListwx = a.collection_picture
                      item.srcList1 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 2){
                      item.srcListzfb = a.collection_picture
                      item.srcList2 = [this.urlimg + a.collection_picture]
                   }else if(a.collection_type == 5){
                      item.srcListyhk = a.collection_picture
                      item.srcList5 = [this.urlimg + a.collection_picture]
                   }
                }  
               }
                            
                    
             }

            //console.log(res)
         })
      },
      search_but(){
        this.page = 1
        this.list_fun()
      },
      refresh_but(){
        this.page = 1
        this.form.phone = ''
        this.form.time1 = ''
        this.form.time2 = ''
        this.list_fun()
      },
       goBack() {
        this.$router.go(-1)
      },
      handleSizeChange(val) {
        console.log(`每页 ${val} 条`);
      },
      handleCurrentChange(val) {
        this.page = val
        this.list_fun()
        console.log(`当前页: ${val}`);
      }
  }
}
</script>


<style scoped>
</style>
